<!DOCTYPE html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta name="google-site-verification" content="-YPbgjltFVFljoCm04Ktk0m38A8CkQxpifuKVZXtawA">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">






















<link href="/blog/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blog/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blog/images/avatar.gif?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blog/images/avatar.gif?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blog/images/avatar.gif?v=5.1.4">


  <link rel="mask-icon" href="/blog/images/avatar.gif?v=5.1.4" color="#222">





  <meta name="keywords" content="linux,">





  <link rel="alternate" href="/blog/atom.xml" title="lfagon" type="application/atom+xml">






<meta name="description" content="在管理 linux 系统中权限是重中之重，管理好一台主机是不容易的，所有我们需要了解他的背后的操作。在我看来，linux 系统是基于文件系统来复制的，不像 window 是系统管理文件，因此我们首先要了解关于权限的各类文件 账号相关文件及档案结构信息  UID: 用户 ID GID: 组 ID  UID 和 GID 用来标识账号名字的一串数字，账号只是让人容易记忆，而 ID 就放在 /etc/pa">
<meta name="keywords" content="linux">
<meta property="og:type" content="article">
<meta property="og:title" content="linux 账户说明">
<meta property="og:url" content="http://lfagon.gitee.io/blog/2018/03/20/linux账户说明/index.html">
<meta property="og:site_name" content="lfagon">
<meta property="og:description" content="在管理 linux 系统中权限是重中之重，管理好一台主机是不容易的，所有我们需要了解他的背后的操作。在我看来，linux 系统是基于文件系统来复制的，不像 window 是系统管理文件，因此我们首先要了解关于权限的各类文件 账号相关文件及档案结构信息  UID: 用户 ID GID: 组 ID  UID 和 GID 用来标识账号名字的一串数字，账号只是让人容易记忆，而 ID 就放在 /etc/pa">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2019-06-21T07:03:43.467Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="linux 账户说明">
<meta name="twitter:description" content="在管理 linux 系统中权限是重中之重，管理好一台主机是不容易的，所有我们需要了解他的背后的操作。在我看来，linux 系统是基于文件系统来复制的，不像 window 是系统管理文件，因此我们首先要了解关于权限的各类文件 账号相关文件及档案结构信息  UID: 用户 ID GID: 组 ID  UID 和 GID 用来标识账号名字的一串数字，账号只是让人容易记忆，而 ID 就放在 /etc/pa">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blog/',
    scheme: 'Mist',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":true,"onmobile":false},
    fancybox: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://lfagon.gitee.io/blog/2018/03/20/linux账户说明/">





  <title>linux 账户说明 | lfagon</title>
  








  <!-- Global site tag (gtag.js) - Google Analytics -->
  <script async src="https://www.googletagmanager.com/gtag/js?id=UA-139884627-1"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
    gtag('config', 'UA-139884627-1');
  </script>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">

    <div class="headband"></div>
    

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blog/" class="brand" rel="start">
        <!-- <span class="logo-line-before"><i></i></span> -->
        <!-- <span class="site-title">lfagon</span> -->
	     <img src="/blog/images/logo.png">
        <!-- <span class="logo-line-after"><i></i></span> -->
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">个人博客</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blog/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blog/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blog/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-top">
          <a href="/blog/top/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-signal"></i> <br>
            
            热门
          </a>
        </li>
      
        
        <li class="menu-item menu-item-schedule">
          <a href="/blog/schedule/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-calendar"></i> <br>
            
            日程表
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tracks">
          <a href="/blog/tracks" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-comment"></i> <br>
            
            留言
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="搜索..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://lfagon.gitee.io/blog/blog/2018/03/20/linux账户说明/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="付祥/lfagon">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blog/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="lfagon">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">linux 账户说明</h2>
        

        <div class="post-meta">
	    
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <font color="blue"><i class="fa fa-calendar-o"></i></font>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-03-20T02:19:59+08:00">
                2018-03-20
              </time>
            

            
              <span class="post-meta-divider">|</span>
            

            
              <span class="post-meta-item-icon">
                 <font color="#40E0D0"><i class="fa fa-calendar-check-o"></i></font>
              </span>
              
                <span class="post-meta-item-text">更新于&#58;</span>
              
              <time title="更新于" itemprop="dateModified" datetime="2019-06-21T15:03:43+08:00">
                2019-06-21
              </time>
            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <font color="red"><i class="fa fa-folder-o"></i></font>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <font color="black"><span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blog/categories/介绍/" itemprop="url" rel="index">
                    <span itemprop="name">介绍</span>
                  </a>
                </span></font>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/blog/2018/03/20/linux账户说明/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count gitment-comments-count" data-xid="/blog/2018/03/20/linux账户说明/" itemprop="commentsCount"></span>
                </a>
              </span>
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                  <span class="post-meta-item-text">字数统计&#58;</span>
                
                <span title="字数统计">
                  1.6k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                
                <span title="阅读时长">
                  5
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>在管理 linux 系统中权限是重中之重，管理好一台主机是不容易的，所有我们需要了解他的背后的操作。在我看来，linux 系统是基于文件系统来复制的，不像 window 是系统管理文件，因此我们首先要了解关于权限的各类文件</p>
<h1>账号相关文件及档案结构信息</h1>
<ul>
<li>UID: 用户 ID</li>
<li>GID: 组 ID</li>
</ul>
<p>UID 和 GID 用来标识账号名字的一串数字，账号只是让人容易记忆，而 ID 就放在 /etc/passwd 里面</p>
<p><strong>我们先来看看跟账户管理相关的文件</strong></p>
<table>
<thead>
<tr>
<th style="text-align:center">信息存储文件</th>
<th style="text-align:center">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><code>/etc/passwd</code></td>
<td style="text-align:center">存放账户信息</td>
</tr>
<tr>
<td style="text-align:center"><code>/etc/shadow</code></td>
<td style="text-align:center">存放账户密码信息</td>
</tr>
<tr>
<td style="text-align:center"><code>/etc/group</code></td>
<td style="text-align:center">存放组信息</td>
</tr>
<tr>
<td style="text-align:center"><code>/etc/gshadow</code></td>
<td style="text-align:center">存放组密码信息</td>
</tr>
</tbody>
</table>
<table>
<thead>
<tr>
<th style="text-align:center">默认配置文件</th>
<th style="text-align:center">描述</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><code>/etc/default/useradd</code></td>
<td style="text-align:center">新建用户默认信息值</td>
</tr>
<tr>
<td style="text-align:center"><code>/etc/login.defs</code></td>
<td style="text-align:center">新建用户默认信息值</td>
</tr>
<tr>
<td style="text-align:center"><code>/etc/skel/*</code></td>
<td style="text-align:center">新建用户的家目录参考的基准目录</td>
</tr>
</tbody>
</table>
<p>这里主要介绍了上面 7 个文件里的内容代表什么意思，在 linux 中，大部分字段分割都是以<code>:</code>分割的，大家可以边看文档，边在 linux 上对应文件上查看</p>
<h1>/etc/passwd</h1>
<p><strong>字段</strong></p>
<ol>
<li>用途</li>
<li>账号名称</li>
<li>密码</li>
<li>UID</li>
<li>GID</li>
<li>用户信息说明栏</li>
<li>家目录</li>
<li>Shell 命令程序</li>
</ol>
<h1>/etc/shadow</h1>
<p><strong>字段</strong></p>
<ol>
<li>账号名称</li>
<li>密码</li>
<li>最近改动密码的日期</li>
<li>密码不可变动的天数（与 3 相比）</li>
<li>密码需要重新变更的天数（与 3 相比）</li>
<li>密码需要变更提前警告天数（与 5 相比）</li>
<li>密码过期后宽限时间（与 5 相比）</li>
<li>账户失效日期</li>
<li>保留</li>
</ol>
<p><strong>密码时间图，括号内数字为上述序号里得意思</strong></p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">(3字段） -&gt;&gt; (4字段） : 正常使用，密码不可以更改</span><br><span class="line">(4字段） -&gt;&gt; (6字段） :正常使用，可以修改</span><br><span class="line">(6字段） -&gt;&gt; (5字段） : 正常使用，提示密码快要到期，提醒修改密码</span><br><span class="line">(5字段） -&gt;&gt; (7字段） : 不能正常使用，上线即要强制修改密码</span><br><span class="line">(7字段） -&gt;&gt; 之后 :密码失效，无法登陆，请求管理员修改</span><br></pre></td></tr></table></figure>
<h1>/etc/group</h1>
<p><strong>字段</strong></p>
<ol>
<li>组名，是用户组的名称，由字母或数字构成。与 /etc/passwd 中的登录名一样，组名不应重复</li>
<li>口令，字段存放的是用户组加密后的口令字。一般都没有口令，即这个字段一般为空，或者是 x</li>
<li>GID</li>
<li>组内用户列表： 每个用户之间用<code>,</code>号分割。 本字段可以为空。 如果字段为空表示用户组为 GID 的用户名</li>
</ol>
<h1>/etc/gshadow</h1>
<p><strong>字段</strong></p>
<ol>
<li>组名： 是用户组的名称，由字母或数字构成。</li>
<li>口令： 用户组密码，这个段可以是空的或<code>!</code>，<code>!</code>表示没有密码</li>
<li>组管理者： 这个字段也可为空，如果有多个用户组管理者，用<code>,</code>分割</li>
<li>组内用户列表： 如果有多个成员，用<code>,</code>分割</li>
</ol>
<h1>/etc/default/useradd</h1>
<ul>
<li>
<p><strong>GROUP=100</strong>新建账号的初始群组使用 GID 为 100</p>
</li>
<li>
<p><strong>HOME=/home</strong>用户家目录的基准目录（basedir)</p>
</li>
<li>
<p><strong>INACTIVE=-1</strong>密码过期后是否会失效设定值，<code>/etc/shadow</code>的第 7 字段，-1 永不失效</p>
</li>
<li>
<p>**EXPIRE=***账号失效的日期，<code>/etc/shadow</code>的第 8 字段</p>
</li>
<li>
<p><strong>SHELL=/bin/bash</strong>默认使用的 shell 程序文件名，<code>/etc/shadow</code>的第 8 字段</p>
</li>
<li>
<p><strong>SKEL=/etc/skel</strong>用户家目录的参考目录，具体详情下面介绍</p>
</li>
<li>
<p><strong>CREATE_MAIL_SPOOL=yes</strong>建立使用者的 mailbox, 可以到 /var/spool/mail/ 目录看一下，会有使用者用户名目录，那就是你的信箱了</p>
</li>
<li>
<p><strong>GROUP=100</strong>系统上面 GID 为 100 者即是 users 这个群组，就是让初始群组为 user. 但是我们知道 CentOS 上面并不是这样的，在 CentOS 上面群组为与账号名相同的群组。举例来说，nihao 的初始群组为 nihao. 这是 因为针对群组的角度有两种不同得机制所致这两种机制分别是：</p>
<p><strong>私有群组机制</strong></p>
<blockquote>
<p>系统会建立一个不账号一样的群组给使用者作为起始群组。这种群组的设 定机制会比较有保密性，这是因为使用者都有自己的群组，而且家目录权限将会设定为 700（仅有自己可进入自己的家目录）。使用这种机制不会参考 GROUP=100 这个 训定值。代表性的 distributions 有 RHEL, Fedora, CentOS 等</p>
</blockquote>
<p><strong>公共群组机制</strong></p>
<blockquote>
<p>就是以 GROUP=100 这个训定值作为新建账号的初始群组，因此每个账号都属于 users 这个群组，默认家目录通常的权限会是 drwxr-xr-x, 由于每个账号都属于 users 群组，因此大家都可以互相分享家目录里的数据。代表 distributions 如 SuSE 等</p>
</blockquote>
</li>
</ul>
<h1>/etc/login.defs</h1>
<ul>
<li><strong>MAIL_DIR /var/spool/mail</strong>用户默认邮件信箱放置目录</li>
<li><strong>PASS_MAX_DAYS 99999</strong>/etc/shadow 内的第 5 字段，多久需变更密码日数</li>
<li><strong>PASS_MIN_DAYS 0</strong>/etc/shadow 内的第 4 字段，多久不可重新设定密码日数</li>
<li><strong>PASS_MIN_LEN 5</strong>密码最短的字符长度，已被 pam 模块取代，失去效用！</li>
<li><strong>PASS_WARN_AGE 7</strong>/etc/shadow 内的第 6 字段，过期前会警告的日数</li>
<li><strong>UID_MIN 500</strong>使用者最小的 UID, 意卲小于 500 的 UID 为系统保留</li>
<li><strong>UID_MAX 60000</strong>使用者能够用的最大</li>
<li><strong>UIDGID_MIN 500</strong>使用者自定义组的最小 GID, 小于 500 为系统保留</li>
<li><strong>GID_MAX 60000</strong>使用者自定义组的最大 GID</li>
<li><strong>CREATE_HOME yes</strong>在不加 -M 及 -m 时，是否主动建立用户家目录</li>
<li><strong>UMASK 077</strong>用户家目录建立的 umask, 因此权限会是 700</li>
<li><strong>USERGROUPS_ENAB yes</strong>使用 userdel 删除时，是否会删除初始群组</li>
<li><strong>MD5_CRYPT_ENAB yes</strong>密码是否经过 MD5 加密处理</li>
</ul>
<h1>/etc/skel/*</h1>
<p>这个就是指定用户家目录的参考基准目录，所有创建用户生成的家目录都是从这个目录复制过去的～所以呢，未来如果我想要让新增使用者时，该用户的环境变量<code>~/.bashrc</code>就设定妥当的话，可以到<code>/etc/skel/.bashrc</code>去编 辑一下，也可以建立<code>/etc/skel/www</code>这个目录，那举未来新增使用者后，在他的家目录下就会有<code>www</code>那个目录了</p>

      
    </div>

    
      





    


    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>如果这篇文章对您很有帮助，不妨</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/blog/images/wechatpay.png" alt="付祥/lfagon 微信支付">
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/blog/images/alipay.jpg" alt="付祥/lfagon 支付宝">
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    
    
    	<div>
	   
             <div>
    
        <div style="margin-top: 30px;text-align:center;color: #ccc;font-size:14px;">-------------　　　　本文结束　<i class="fa fa-heart"></i>　感谢您的阅读　　　　-------------</div>
    
</div>
           
        </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blog/tags/linux/" rel="tag"><i class="fa fa-tag"></i> linux</a>
          
        </div>
      

      
      
        <div class="post-widgets">
        
          <div class="wp_rating">
            <div style="color: rgba(0, 0, 0, 0.75); font-size:13px; letter-spacing:3px">(&gt;看完记得五星好评哦亲&lt;)</div>
            <div id="wpac-rating"></div>
          </div>
        

        

        
          
          <div id="needsharebutton-postbottom">
            <span class="btn">
              <i class="fa fa-share-alt" aria-hidden="true"></i>
            </span>
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blog/2018/04/18/mysql修改密码/" rel="prev" title="mysql 修改密码">
                mysql 修改密码 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
        
  <div class="bdsharebuttonbox">
    <a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
    <a href="#" class="bds_douban" data-cmd="douban" title="分享到豆瓣网"></a>
    <a href="#" class="bds_sqq" data-cmd="sqq" title="分享到QQ好友"></a>
    <a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
    <a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
    <a href="#" class="bds_tieba" data-cmd="tieba" title="分享到百度贴吧"></a>
    <a href="#" class="bds_twi" data-cmd="twi" title="分享到Twitter"></a>
    <a href="#" class="bds_fbook" data-cmd="fbook" title="分享到Facebook"></a>
    <a href="#" class="bds_more" data-cmd="more"></a>
    <a class="bds_count" data-cmd="count"></a>
  </div>
  <script>
    window._bd_share_config = {
      "common": {
        "bdText": "",
        "bdMini": "2",
        "bdMiniList": false,
        "bdPic": ""
      },
      "share": {
        "bdSize": "24",
        "bdStyle": "0"
      },
      "image": {
        "viewList": ["tsina", "douban", "sqq", "qzone", "weixin", "twi", "fbook"],
        "viewText": "分享到：",
        "viewSize": "7"
      }
    }
  </script>

<script>
  with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='/static/api/js/share.js?cdnversion='+~(-new Date()/36e5)];
</script>

      
  </div>


          </div>
          

  
    <div class="comments" id="comments">
      
        <div id="gitment-container"></div>
      
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image" src="/blog/images/avatar.jpg" alt="付祥/lfagon">
            
              <p class="site-author-name" itemprop="name">付祥/lfagon</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blog/archives/">
              
                  <span class="site-state-item-count">77</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/blog/categories/index.html">
                  <span class="site-state-item-count">6</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blog/tags/index.html">
                  <span class="site-state-item-count">28</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/blog/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/lfagon" target="_blank" title="Github">
                      
                        <i class="fa fa-fw fa-github"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://gitee.com/lfagon" target="_blank" title="Gitee">
                      
                        <i class="fa fa-fw fa-git"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:slash7675@gmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i></a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="https://plus.google.com/" target="_blank" title="Google">
                      
                        <i class="fa fa-fw fa-google"></i></a>
                  </span>
                
            </div>
          

          
          
            <div class="cc-license motion-element" itemprop="license">
              <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" class="cc-opacity" target="_blank">
                <img src="/blog/images/cc-by-nc-sa.svg" alt="Creative Commons">
              </a>
            </div>
          

          
          
            <div class="links-of-blogroll motion-element links-of-blogroll-block">
              <div class="links-of-blogroll-title">
                <i class="fa  fa-fw fa-globe"></i>
                圈子里住着一群可爱的程序猿&nbsp;<i class="fa fa-fw fa-globe fa-flip-horizontal"></i>
              </div>
              <ul class="links-of-blogroll-list">
                
                  <li class="links-of-blogroll-item">
                    <a href="https://reuixiy.github.io/" title="一个Hexo博客玩到极致的大佬" target="_blank">一个Hexo博客玩到极致的大佬</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://mmmmasterc.github.io/" title="又菜又爱秀的哥们" target="_blank">又菜又爱秀的哥们</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://www.codesheep.cn/" title="乐于分享的华科Java程序羊(B站up主)" target="_blank">乐于分享的华科Java程序羊(B站up主)</a>
                  </li>
                
                  <li class="links-of-blogroll-item">
                    <a href="https://me.idealli.com/" title="前端大神自称兰州小红鸡" target="_blank">前端大神自称兰州小红鸡</a>
                  </li>
                
              </ul>
            </div>
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">1.</span> <span class="nav-text">账号相关文件及档案结构信息</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">2.</span> <span class="nav-text">/etc/passwd</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">3.</span> <span class="nav-text">/etc/shadow</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">4.</span> <span class="nav-text">/etc/group</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">5.</span> <span class="nav-text">/etc/gshadow</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">6.</span> <span class="nav-text">/etc/default/useradd</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">7.</span> <span class="nav-text">/etc/login.defs</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#undefined"><span class="nav-number">8.</span> <span class="nav-text">/etc/skel/*</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
    </div>
  </aside>


        
      </div>
    </div></main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
  <span class="with-love">
    <font color="red"><i class="fa fa-heartbeat" aria-hidden="true"></i></font>
  </span>
  <span class="author" itemprop="copyrightHolder">copyright</span>
  &nbsp;<a href="https://www.oschina.net/"><font size="2px">中国开源社区</font></a>

  
</div>




<div style="width:300px;margin:0 auto; padding:0 0;">
   <a href style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img src="/blog/images/icons/record.png" style="float:left;height:90%;width:auto;"><p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;letter-spacing:0px"><font size="2px">公网安备 xxxxxxxxxxx号</font></p></a>
</div>





        
<div class="busuanzi-count">
  <script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  
    <span class="site-uv">
      <i class="fa fa-user">&nbsp;访客量：</i>
      <span class="busuanzi-value" id="busuanzi_value_site_uv"></span>
      
    </span>
  

  
    <span class="site-pv">
      <i class="fa fa-eye">&nbsp;访问量：</i>
      <span class="busuanzi-value" id="busuanzi_value_site_pv"></span>
      
    </span>
  
</div>




        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>




















  
  
    <script type="text/javascript" src="/blog/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blog/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  

  <script type="text/javascript" src="/blog/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/motion.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/image.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/linkcard.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/clicksocialvalue.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blog/js/src/clicklove.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/blog/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blog/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blog/js/src/bootstrap.js?v=5.1.4"></script>



  



	





  




  





<!-- LOCAL: You can save these files to your site and update links -->
    
        
        <link rel="stylesheet" href="https://aimingoo.github.io/gitmint/style/default.css">
        <script src="https://aimingoo.github.io/gitmint/dist/gitmint.browser.js"></script>
    
<!-- END LOCAL -->

    

    
      <script type="text/javascript">
      function renderGitment(){
        var gitment = new Gitmint({
            id: window.location.pathname, 
            owner: 'lfagon',
            repo: 'BlogComment',
            
            lang: "" || navigator.language || navigator.systemLanguage || navigator.userLanguage,
            
            oauth: {
            
            
                client_secret: 'de7d4aee11c1d7e4fd0ab75222817a4875fb378c',
            
                client_id: '969cf8ab6443ea4bd042'
            }});
        gitment.render('gitment-container');
      }

      
      renderGitment();
      
      </script>
    





  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/blog/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  
  
  <link rel="stylesheet" href="/blog/lib/needsharebutton/needsharebutton.css">

  
  
  <script src="/blog/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  
  <script type="text/javascript">
  wpac_init = window.wpac_init || [];
  wpac_init.push({widget: 'Rating', id: 18607,
    el: 'wpac-rating',
    color: 'f79533'
  });
  (function() {
    if ('WIDGETPACK_LOADED' in window) return;
    WIDGETPACK_LOADED = true;
    var mc = document.createElement('script');
    mc.type = 'text/javascript';
    mc.async = true;
    mc.src = '//embed.widgetpack.com/widget.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(mc, s.nextSibling);
  })();
  </script>


  

  
<script>
  $('.highlight').each(function(i, e) {
    var $wrap = $('<div>').addClass('highlight-wrap');
    $(e).after($wrap);
    $wrap.append($('<button>').addClass('copy-btn').append('复制').on('click', function(e) {
      var code = $(this).parent().find('.code').find('.line').map(function(i, e) {
        return $(e).text();
      }).toArray().join('\n');
      var ta = document.createElement('textarea');
      var yPosition = window.pageYOffset || document.documentElement.scrollTop;
      ta.style.top = yPosition + 'px'; // Prevent page scroll
      ta.style.position = 'absolute';
      ta.style.opacity = '0';
      ta.readOnly = true;
      ta.value = code;
      document.body.appendChild(ta);
      ta.select();
      ta.setSelectionRange(0, code.length);
      ta.readOnly = false;
      var result = document.execCommand('copy');
      
        if (result) $(this).text('复制成功');
        else $(this).text('复制失败');
      
      ta.blur(); // For iOS
      $(this).blur();
    })).on('mouseleave', function(e) {
      var $b = $(this).find('.copy-btn');
      setTimeout(function() {
        $b.text('复制');
      }, 300);
    }).append(e);
  })
</script>


  

  

</body>
</html>
